<!--分页 -->
{{ user_id }}
{% if pagination.pages>1 %}
    <nav class="mt-5">
        {% set args_dict = request.args.to_dict() %}
        {% set new_args = args_dict.update(request.view_args) %}
        <ul class="pagination justify-content-center">
            <li class="page-item">
                {% set new_args = args_dict.update({'page': 1}) %}
                <a class="page-link" href="{{ url_for(request.endpoint, **args_dict) }}">首页</a>
            </li>
            {% if pagination.has_prev %}
                <li class="page-item">
                    {% set new_args = args_dict.update({'page': pagination.prev_num}) %}
                    <a class="page-link"
                       href="{{ url_for(request.endpoint, **args_dict) }}">上一页</a>
                </li>
            {% endif %}
            {% for page_num in pagination.iter_pages(left_edge=2, left_current=2, right_current=3, right_edge=2) %}
                {% if page_num %}
                    {% set new_args = args_dict.update({'page': page_num}) %}
                    {% if pagination.page == page_num %}
                        <li class="page-item active"><span class="page-link">{{ page_num }}</span></li>
                    {% else %}

                        <li class="page-item"><a class="page-link"
                                                 href="{{ url_for(request.endpoint,**args_dict) }}">{{ page_num }}</a>
                        </li>
                    {% endif %}
                {% else %}
                    <li class="page-item disabled"><span class="page-link">...</span></li>
                {% endif %}
            {% endfor %}
            {% if pagination.has_next %}
                <li class="page-item">
                    {% set new_args = args_dict.update({'page': pagination.next_num}) %}
                    <a class="page-link" href="{{ url_for(request.endpoint,**args_dict) }}">{{ page_num }}下一页</a>
                </li>
            {% endif %}
            <li class="page-item">
                {% set new_args = args_dict.update({'page': pagination.pages}) %}
                <a class="page-link" href="{{ url_for(request.endpoint,**args_dict) }}">末页</a>
            </li>
        </ul>
    </nav>
{% endif %}